from typing import Optional

from pydantic import BaseModel, Field


class NetWorkInfo(BaseModel):
    name: Optional[str] = Field(default=None, title="网络连接名称")
    device: Optional[str] = Field(default=None, title="网络驱动名称")
    type: Optional[str] = Field(default=None, title="驱动类型")
    method: Optional[str] = Field(default=None, title="网络工作模式，manual static")
    state: Optional[str] = Field(default=None, title="网络连接状态")
    address: Optional[str] = Field(default=None, title="网络地址")
    netmask: Optional[str] = Field(default=None, title="子网掩码")
    gateway: Optional[str] = Field(default=None, title="网关地址")
    dns: Optional[str] = Field(default=None, title="DNS服务器")


class UpdateNetwork(BaseModel):
    name: str = Field(default=None, title="网络连接名称")
    method: Optional[str] = Field(default="auto", title="网络工作模式，manual static")
    address: Optional[str] = Field(default=None, title="网络地址")
    netmask: Optional[str] = Field(default=None, title="子网掩码")
    gateway: Optional[str] = Field(default=None, title="网关地址")
    dns: Optional[str] = Field(default=None, title="DNS服务器")


class UsableWiFiInfo(BaseModel):
    ssid: str = Field(title="wifi名称")
    used: bool = Field(title="是否使用中")
    chan: int = Field(title="信道")
    rate: int = Field(title="传输速率")
    signal: int = Field(title="信号强度")
    security: str = Field(title="安全性")


class ConnectToWiFi(BaseModel):
    ssid: str = Field(title="wifi名称")
    password: str = Field(title="wifi密码")
